package com.aiapphub.BaseCode.service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

public interface SSOLoginService {
    String buildLoginUrl() throws UnsupportedEncodingException;;

    /**
     * 处理SSO回调请求
     *
     * @param code 从SSO系统返回的授权码
     * @param session 当前会话
     * @param response HTTP响应
     * @throws IOException 如果处理请求时出错
     */
    void handleSSOCallback(String code, HttpSession session, HttpServletResponse response) throws IOException;

    /**
     * 处理登出操作
     *
     * @param request HTTP 请求对象
     * @param response HTTP 响应对象
     * @param redirectUrl 重定向的 URL
     * @throws IOException 可能抛出的 IO 异常
     */
    void handleLogout(HttpServletRequest request, HttpServletResponse response, String redirectUrl) throws IOException;
}
